<!DOCTYPE html>
<html>
	<head>
		<meta charset="UTF-8">
		<title></title>
		<link href="<?php echo base_url('web');?>/css/bootstrap.min.css" rel="stylesheet" />
		<script src="<?php echo base_url('web');?>/js/jquery-3.2.0.min.js" ></script>
		<script src="<?php echo base_url('web');?>/js/bootstrap.min.js" ></script>
		<script src="<?php echo base_url('web');?>/js/config.js"></script>
	</head>
	<body style="padding:100px">
		<div class="panel panel-default">
			<!-- Default panel contents -->
			<div class="panel-heading">评分</div>
	
			<!-- Table -->
			<table class="table">
				<tbody>
					<?php foreach($iws as $k=>$v){ ?>
						<tr class="li">
							<th class="id" score="<?php echo $v['score']?>"><?php echo $v['name'];?></th>
							<?php foreach($options as $kk=>$vv){ ?>
								<td><lable><input type="radio" name="<?php echo $v['name'];?>" value="<?php echo $vv['eval']?>"/><?php echo $vv['name'];?></lable></td>
							<?php }?>
						</tr>
					<?php } ?>
					<tr><td><button type="button" class="btn btn-default" id="btn">评分</button></td></tr>
				</tbody>
			</table>
		</div>
		<script>
			var turl = '<?php echo base_url("index.php/{$radio}/marking_stepSaveScore/{$id}");?>/';
			var $btn = $('#btn');
			var $trs = $('.table tr.li');
			console.log($trs);
			$btn.on('click',function(){
				var sum=0;
				$trs.each(function(){
					var $tr = $(this);
					var score = $tr.find('.id').attr('score');
					var eval = $tr.find('input[type="radio"]:checked').val();
					console.log(score,eval);
					sum += eval*score;
				});
				console.log(sum);
				turl += sum;
				console.log(turl);
				$.get(turl,{},function(res){
					alert('评分成功');
					self.location=document.referrer;
				});
			});
		</script>
	</body>
</html>
